#!/bin/bash
#
# Installer for Konsole-DCOP-Schema script.
#
# Copyright (C) 2007 Michael T. Dean
# miketdean@gmail.com
#
# Run this installer to install the script.
#
##########################################################

# First, decide where to put the script itself

if [ -d ~/bin ]
then
	cp konsole-dcop-schemas ~/bin
elif [ -d /usr/local/bin ]
then
	cp konsole-dcop-schemas /usr/local/bin
else
	cp konsole-dcop-schemas /usr/bin
fi

# Now, copy the settings files into place

if [ ! -d ~/.konsole_dcop ]
then
	mkdir ~/.konsole_dcop
fi

cp konsole_dcop.aliases ~/.konsole_dcop/
cp schemas ~/.konsole_dcop/

# Finally, add the line to import the aliases to either .bashrc or .profile

if [ -f ~/.bashrc ]
then
	echo '. ~/.konsole_dcop/konsole_dcop.aliases' >> ~/.bashrc
elif [ -f ~/.profile ]
then
	echo '. ~/.konsole_dcop/konsole_dcop.aliases' >> ~/.profile
else
	printf "\t\e[01;31mError: No suitable file found to setup automatic inclusion of aliases.\n\e[01;33mPlease see the README file to see how to perform this step.\e[00;m\n"
fi

printf "\n\e[01;32mIf you didn't see any error messages above, then the script should be successfully installed.  To start using the script now, either log out and back in, or type:\n\n\t\e[01;36m. ~/.konsole_dcop/konsole_dcop.aliases\n\n\e[01;32mto setup the aliases you need in your shell.  Don't forget the dot (.) at the beginning! \n\n\e[00;m"

